<?php
    // 这个接口用于删除指定id的文章数据

    include_once '../../fn.php';

    $id = $_GET['id'];

    // 构造数据库执行串
    $sql = "delete FROM posts WHERE id=$id;";

    // 执行
    $result = my_exec($sql);

    $sql2 = "select COUNT(*) AS 'total' from posts 
    JOIN users ON posts.user_id = users.id 
    JOIN categories ON posts.category_id = categories.id";

    $result2 = my_query($sql2);
    // echo '<pre>';
    // print_r($result2);
    // echo '</pre>';
    $result['total'] = $result2[0]['total'];

    echo json_encode($result);

?>